import sys

from PySide.QtCore import *
from PySide.QtGui import *

from uart_swd import Ui_MainWindow

import serial
import serial.tools.list_ports

class Windows(QMainWindow):
   def __init__(self, parent=None):
       QMainWindow.__init__(self, parent)

       self.ui= Ui_MainWindow()
       self.ui.setupUi(self)
       port_list = list(serial.tools.list_ports.comports())
       print(dir(self.ui.PortList))
       for item in port_list:
           self.ui.PortList.addItem(item[1])


def main():
   app = QApplication(sys.argv)
   d = Windows()
   d.show()
   sys.exit(app.exec_())

if __name__ == '__main__':
   main()
